#pragma once

#include "Globals.h"

//Used to make a list of all different object use and create functions
typedef FunctionReturn (*UseOptions)(BaseObject* User);
typedef FunctionReturn (*MakeOptions)(ResourceBag* RB);

//Each new item needs their own function
FunctionReturn UseTNT(BaseObject* User);
FunctionReturn CanMakeTNT(ResourceBag* RB);
FunctionReturn UsePickaxe(BaseObject* User);
FunctionReturn CanMakePickaxe(ResourceBag* RB);

//Creates the lists globaly and adds every objects functions to the list
static UseOptions UseObject[SIZE_ITEM]={
	&UseTNT,
	&UsePickaxe
};

static MakeOptions CanMakeObject[SIZE_ITEM]={
	&CanMakeTNT,
	&CanMakePickaxe
};

class Item
{
private:
	//If the item can be used
	bool Enabled;
	//What kind of item is it
	eItemType m_eType;
public:
	Item():Enabled(false),m_eType(SIZE_ITEM){}
	
	//Enable/Disable
	const FunctionReturn SetUsableState(bool S) {Enabled = S;return SUCCEED;}

	const bool IfUsable() const{return Enabled;}
	
	//Changes the type of object it is
	const FunctionReturn SetType(eItemType TYPE){m_eType = TYPE;return SUCCEED;}

	//Uses the item, based on what type of item it is
	// Onced used it is no longer usable
	const FunctionReturn Use(BaseObject* User)
	{
		RETURN_CHECK( UseObject[m_eType](User) );
		SetUsableState(false);
		return SUCCEED;
	}
};